package com.software.form.bookingform.dao;

import java.util.List;

public class BookingFormTransaction {

	private BookingFormDao bookingFormDao;

	public BookingFormDao getBookingFormDao() {
		return bookingFormDao;
	}

	public void setBookingFormDao(BookingFormDao bookingFormDao) {
		this.bookingFormDao = bookingFormDao;
	}
	
	public List<BookingForm> getFormByEmail(String email, int status){
		return bookingFormDao.queryByLinerEmail(email, status);
	}
	
	public BookingForm getBookingFormByNo(String no){
		return bookingFormDao.queryByNo(no);
	}
	
	public BookingForm getBookingFormById(int id){
		return bookingFormDao.queryById(id);
	}
	
	public boolean updateStatusById(int id,int status){
		return bookingFormDao.updateStatus(id, status);
	}
	
	public boolean updateNoById(int id,String no){
		return bookingFormDao.updateNo(id, no);
	}
	
	public boolean add(String consignee,String weight,String volumne,String marksAndNo,
			String NotifyParty,String no,String  quantity,String oceanVessel,String DeliveryPlace,
			String dischargePort,String loadingPort,String receiptPlace,String Shipper,int status,
			String cargoName,String lagentEmail,String sagentEmail){
		BookingForm bf = new BookingForm();
		bf.setConsignee(consignee);
		bf.setKgs(weight);
		bf.setM3(volumne);
		bf.setMark(marksAndNo);
		bf.setNp(NotifyParty);
		bf.setNo(no);
		bf.setNop(quantity);
		bf.setOv(oceanVessel);
		bf.setPodel(DeliveryPlace);
		bf.setPodis(dischargePort);
		bf.setPol(loadingPort);
		bf.setPor(receiptPlace);
		bf.setShipper(Shipper);
		bf.setStatus(status);
		bf.setType(cargoName);
		bf.setLagentEmail(lagentEmail);
		bf.setSagentEmail(sagentEmail);
		return bookingFormDao.add(bf);
	}
}
